package com.mainService.newService;

import com.projectCommon.util.commonUtil.FileUtil;
import org.junit.Test;

import java.io.*;

public class Convert {
    @Test
    public void excelToPic() throws IOException {
        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;
        try {
            fileInputStream = new FileInputStream("C:\\Users\\wy\\Desktop\\2222222\\1.xls");
            ByteArrayOutputStream byteArrayOutputStream = FileUtil.excel2Pic(fileInputStream);
            fileOutputStream = new FileOutputStream("C:\\Users\\wy\\Desktop\\2222222\\1.jpg");
            fileOutputStream.write(byteArrayOutputStream.toByteArray());
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } finally {
            assert fileInputStream != null;
            fileInputStream.close();
            assert fileOutputStream != null;
            fileOutputStream.close();
        }
    }
}
